Hello Everybody!
ik made a program in C# to save OV-numbers, i made this by using a DataSet and a XML file.
in the DataSet there a two Columns one called OV-numbers and the other one is called Status.
Things that i already can with this program:
* add a new item to the Dataset and save in in the XML file.
* Show all the items in a listbox.
the next thing i would like to do with this program is: modify each single Status item in the column 1. each of this numbers is connected to a OV-number.
each of the OV-numbers are added into the Combobox: cmbxOVnummer. the ranking in the listbox where i showed the items is the same like in the combobox. in the code i tried to search trough all the rows in the Data-table looking for the same item(OV-number in colomn 0)that is selected in the combo-box(OV-number)
after that i checked the radio buttons of be checked of not. as you can see then i try to change the Status in that row who is picked out the foreach-loop. after that i try to save the modified items and write it in the XML file. and refresh the listbox too see the changes.
But all this is not working and there dont show up any Errors of warnings when i run this program.
So what is wrong about this? and how could i fix it?
Code:
private void btnVeranderStatus_Click(object sender, EventArgs e)
{
foreach (DataRow drStudents in dsStudenten.Tables["student"].Rows)
{
if (cmbxOVnummer.SelectedValue == drStudents[0])
{
if (rbtnAanwezig.Checked)
{
drStudents[1] = "1";
}
else
{
drStudents[1] = "0";
}
}
}
dsStudenten.AcceptChanges();
StreamWriter WriteChangestoXML = new StreamWriter("studenten.xml");
dsStudenten.WriteXml(WriteChangestoXML);
WriteChangestoXML.Close();
lbxStudenten.Refresh();
}
who wants too see all the code
go to http://www.keepmyfile.com/download/50d26a2325571
and click download i upload a .txt file with the code.
thank you for your support
Jeltn.